package com.lego.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.lego.bean.Goods;
import com.lego.bean.OrderDTO;
import com.lego.bean.Orders;
import com.lego.bean.Page;
import com.lego.service.OrdersService;
import com.lego.service.impl.OrdersServiceImpl;

/**
 * Servlet implementation class SelectOrderIdSerlvet
 */
@WebServlet("/selectOrderByONum.do")
public class SelectOrderByNumServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    	String orderNum = request.getParameter("orderNum");
        OrdersService os = new OrdersServiceImpl();
        OrderDTO orderDTO = os.selectOrderByONum(orderNum);
        response.setContentType("application/json;charset=utf-8");
		ObjectMapper om = new ObjectMapper();
		String str = om.writeValueAsString(orderDTO);
		response.getWriter().write(str);
    }
}
